Field of the Invention
The invention relates to video processing, and more particularly to motion prediction of video data.
Description of the Related Art
The new upcoming H.264 compression standard can provide good video quality at substantially lower bit rates than previous standards by adopting features such as sub-pixel accuracy and multiple-referencing. The video compression process can be generally divided into 5 parts which include: inter-prediction/intra-prediction, transform/inverse-transform, quantization/inverse-quantization, loop filter, and entropy encoding. H.264 is used in various applications such as Blu-ray Discs, DVB broadcasting services, direct-broadcast satellite television service, cable television services, and real-time videoconferencing.
A video datastream comprises a series of frames. Each frame is divided into a plurality of coding units (e.g. macroblocks or extended macroblocks) for video processing. Each coding unit can be segmented into quad-tree partitions, and a leaf coding unit is called a prediction unit. A prediction unit can be further segmented into quad-tree partitions, and each partition is assigned with a motion parameter. In order to reduce the cost of transmitting enormous amount of motion parameters, a motion vector predictor (MVP) is calculated for each partition by referencing to adjacent coded blocks, coding efficiency can thus be improved as the motion of the adjacent blocks tends to have high spatial correlation.
Referring to FIG. 1, a schematic diagram of a current unit 100 and a plurality of neighboring units A, B, C, and D are shown. In this example, both the current unit 100 and neighboring units A, B, C and D are the same size; however, these units are not necessary to be the same size. The motion vector predictor (MVP) of the current unit 100 is predicted according to the motion vectors of the neighboring units A, B, and C, or A, B, and D if C is unavailable. When the current unit 100 is a 16×16 block and a motion vector of the neighboring unit C exists, a medium of the motion vectors of the neighboring units A, B, and C is determined to be the MVP of the current unit 100. When the current unit 100 is a 16×16 block and a motion vector of the neighboring unit C does not exist, a medium of the motion vectors of the neighboring units A, B, and D is determined to be the MVP of the current unit 100. When the current unit 100 is an 8×16 partition in a left half of a 16×16 block, a motion vector of the neighboring unit A is determined to be the MVP of the current unit 100. When the current unit 100 is an 8×16 partition in a right half of a 16×16 block, a motion vector of the neighboring unit C is determined to be the MVP of the current unit 100. When the current unit 100 is a 16×8 partition in an upper half of a 16×16 block, a motion vector of the neighboring unit B is determined to be the MVP of the current unit 100. When the current unit 100 is a 16×8 partition in a lower half of a 16×16 block, a motion vector of the neighboring unit A is determined to be the MVP of the current unit 100.
When an MVP of a current unit is predicted according to the motion vectors of the neighboring units A, B, C, and D, the motion vectors of the neighboring units A, B, C, and D are not properly temporal scaled. For example, the reference frame of the neighboring units A, B, and C are different, and the motion vectors of the neighboring units A, B, and C correspond to the reference frames respectively. The temporal distances between each of the reference frames and the current frame are different. The motion vectors of the neighboring units A, B, and C should therefore be temporal scaled according to the temporal distances before predicting the MVP of the current unit 100 according to the motion vectors of the neighboring units A, B, and C.
The MVP of the current unit 100 is only predicted according to the motion vectors of the neighboring units A, B, C, and D. The prediction accuracy of MVP may be further improved if more candidate MVPs are considered and the best out of the candidate MVPs is selected by rate-distortion optimization. For example, motion vector competition (MVC) is proposed to select the best MVP from a predefined candidate set specified in sequence level. The predefined candidate set may include the H.264 standard predictor (e.g. the median MV of neighboring units), MV of the collocated unit at the same location in a reference frame as that of the current unit, and MVs of the neighboring units. The recommended number of MVPs in the predefined candidate set is two. The predefined candidate set, according to the motion vector competition method, is fixed in a video sequence level.